﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Root.master" AutoEventWireup="true" CodeFile="arh.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="Server">
    <script src="../Scripts/toolbar.js" type="text/javascript"></script>
        <script type="text/javascript">
            var command;
            function OnBeginCallback(s, e) {
                command = e.command;
            }
            function OnEndCallback(s, e) {
                if (command == "STARTDEL") {
                    if (s.cpCancelDEL)
                        alert("The record can't be edit, reason: " + s.cpMessage);
                }
            }
    </script>
    <asp:EntityDataSource ID="ds_arcObject" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="ARCOBJECT">
    </asp:EntityDataSource>
    <div class="pageLabel">
        <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Структура архива" Font-Size="Medium" Theme="iOS">
        </dx:ASPxLabel>
    </div>
    <div style="margin-left: 10px; margin-bottom: auto;">

        <dx:ASPxMenu ID="Menu_arcObject" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
            SeparatorHeight="15px" ItemSpacing="1px">
            <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
            <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_arcObject); }" />
            <Items>
                <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                    <Image Url="~/Images/shared/edit_add.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                    <Image Url="~/Images/shared/edit.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                    <Image Url="~/Images/shared/editdelete.png">
                    </Image>
                </dx:MenuItem>
            </Items>
        </dx:ASPxMenu>
    </div>
    <div style="float: left; margin-right: 10px; margin-left: 10px">
        <dx:ASPxGridView ID="grd_arcObject" ClientInstanceName="grd_arcObject" runat="server"
            AutoGenerateColumns="False" DataSourceID="ds_arcObject" KeyFieldName="CODE" OnRowInserting="grd_arcObject_RowInserting" Width="610px" OnRowDeleting="grd_arcObject_RowDeleting">
            <Columns>
                <dx:GridViewCommandColumn VisibleIndex="0" Visible="False">
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="CODE" ReadOnly="True" VisibleIndex="1" Visible="False">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="NAME" VisibleIndex="2" Caption="Наименование объекта" Width="45%">
                    <EditFormSettings CaptionLocation="Top" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="ADDR" VisibleIndex="3" Caption="Адрес объекта">
                    <EditFormSettings CaptionLocation="Top" />
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" />
            <SettingsEditing EditFormColumnCount="1" />
            <SettingsDetail ShowDetailRow="True" AllowOnlyOneMasterRowExpanded="True" />
            <Templates>
                <DetailRow>
                    <div style="background-image: url('/Images/shared/ToolBars/Office2007/Background.gif'); background-repeat: repeat; font-size: 12px; font-weight: bold;" align="center">
                        Помещения
                            <div style="float: left; margin-left: 10px;">

                                <dx:ASPxMenu ID="mMenu" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
                                    SeparatorHeight="15px" ItemSpacing="1px">
                                    <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
                                    <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_room); }" />
                                    <Items>
                                        <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                                            <Image Url="~/Images/shared/edit_add.png">
                                            </Image>
                                        </dx:MenuItem>
                                        <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                                            <Image Url="~/Images/shared/edit.png">
                                            </Image>
                                        </dx:MenuItem>
                                        <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                                            <Image Url="~/Images/shared/editdelete.png">
                                            </Image>
                                        </dx:MenuItem>
                                    </Items>
                                </dx:ASPxMenu>
                            </div>

                        <dx:ASPxGridView ID="grd_room" ClientInstanceName="grd_room" runat="server" AutoGenerateColumns="False" DataSourceID="ds_ArcRoom"
                            Width="100%"
                            KeyFieldName="CODE" OnBeforePerformDataSelect="grd_room_BeforePerformDataSelect" OnRowInserting="grd_room_RowInserting" Theme="Default" OnRowDeleting="grd_room_RowDeleting">
                            <Columns>
                                <dx:GridViewCommandColumn VisibleIndex="0" Visible="False">
                                </dx:GridViewCommandColumn>
                                <dx:GridViewDataTextColumn FieldName="CODE" ReadOnly="True" VisibleIndex="1" Visible="False">
                                    <EditFormSettings Visible="False" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="ARCOBJECT" VisibleIndex="2" Visible="False">
                                    <EditFormSettings Visible="False" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="NOTE" VisibleIndex="3" Caption="Описание">
                                    <EditFormSettings CaptionLocation="Top" />
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <SettingsBehavior AllowFocusedRow="True" />
                            <SettingsEditing EditFormColumnCount="1" Mode="EditForm" />
                            <Settings ShowColumnHeaders="False" />
                            <SettingsDetail AllowOnlyOneMasterRowExpanded="True" ShowDetailRow="True" />
                            <Templates>
                                <DetailRow>
                                    <div style="background-image: url('/Images/shared/ToolBars/Office2007/Background.gif'); background-repeat: repeat; font-size: 12px; font-weight: bold;" align="center">
                                        Стеллажи
                            <div style="float: left; margin-left: 10px;">

                                <dx:ASPxMenu ID="Menu_ArcRack" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
                                    SeparatorHeight="15px" ItemSpacing="1px">
                                    <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
                                    <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_ArcRack); }" />
                                    <Items>
                                        <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                                            <Image Url="~/Images/shared/edit_add.png">
                                            </Image>
                                        </dx:MenuItem>
                                        <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                                            <Image Url="~/Images/shared/editdelete.png">
                                            </Image>
                                        </dx:MenuItem>
                                    </Items>
                                </dx:ASPxMenu>
                            </div>

                                        <dx:ASPxGridView ID="grd_ArcRack" ClientInstanceName="grd_ArcRack" runat="server" AutoGenerateColumns="False" DataSourceID="ds_ArcRack"
                                            Width="100%"
                                            KeyFieldName="CODE" OnBeforePerformDataSelect="grd_ArcRack_BeforePerformDataSelect" OnRowInserting="grd_ArcRack_RowInserting" Theme="Default" OnRowDeleting="grd_ArcRack_RowDeleting">
                                            <ClientSideEvents BeginCallback="OnBeginCallback" EndCallback="OnEndCallback" />
                                            <Columns>
                                                <dx:GridViewDataTextColumn FieldName="CODE" ReadOnly="True" Visible="False" VisibleIndex="0">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="ARCROOM" Visible="False" VisibleIndex="1">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="№ стелажа" FieldName="NOMER" VisibleIndex="2">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Число полок" FieldName="SHELFCOUNT" VisibleIndex="3">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Число ячеек на полке" FieldName="CELLCOUNT" VisibleIndex="4">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Число папок в ячейке" FieldName="PLACECOUNT" VisibleIndex="5">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <SettingsBehavior AllowFocusedRow="True" />
                                            <SettingsEditing EditFormColumnCount="1" Mode="EditForm" />
                                        </dx:ASPxGridView>
                                    </div>
                                </DetailRow>
                            </Templates>
                        </dx:ASPxGridView>
                    </div>
                </DetailRow>
            </Templates>
        </dx:ASPxGridView>
        <asp:EntityDataSource ID="ds_ArcRack" runat="server" AutoGenerateWhereClause="True" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="ARCRACK" Where="">
            <WhereParameters>
                <asp:SessionParameter Name="ARCROOM" SessionField="ARCROOM" />
            </WhereParameters>
        </asp:EntityDataSource>
    </div>
    <asp:EntityDataSource ID="ds_ArcRoom" runat="server" AutoGenerateWhereClause="True" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="ARCROOM" Where="">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" Name="ARCOBJECT" SessionField="ARCOBJECT" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>

